package com.ymanage.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.ymanage.dao.FinanceIncomeMapper;
import com.ymanage.dao.FinancePayGoodsMapper;
import com.ymanage.entity.Order;

/**
 * 
 * <p>Title:FinanceIncomeService </p>
 * <p>Description: 收入业务层</p>
 * <p>Project:yumi </p>
 * @author alen
 * @Version 1.0
 * @date 2017年9月4日 下午5:27:29
 */
public class FinanceIncomeService {

	@Autowired
	private FinanceIncomeMapper financeIncomeMapper;
	
	@Autowired
	private FinancePayGoodsMapper financePayGoodsMapper;
	
	/**
	 * 已付款订单列表
	 * @return
	 */
	public List<Order> orderList(){
		
		return financeIncomeMapper.orderList();
	}
	
	/**
	 * 得到今日订单收入
	 * @return
	 */
	public Double getTodayMoney(Date day){
		
		return financeIncomeMapper.getTodayMoney(day);
	}
	
	/**
	 * 得到本月订单收入
	 * @return
	 */
	public Double getMonthMoney(){
		
		return financeIncomeMapper.getMonthMoney();
	}
	
	/**
	 * 得到本年订单收入
	 * @return
	 */
	public Double getYearMoney(){
		
		return financeIncomeMapper.getYearMoney();
	}
	
	/**
	 * 本月毛利润
	 * @return
	 */
	public Double getGrossProfit(){
		
		Double grossProfit = financeIncomeMapper.getMonthMoney() - financePayGoodsMapper.getMonthGoodsPay();
	
		return grossProfit;
	} 
}
